﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ChargeAdmin.aspx.cs" Inherits="Gift_ChargeAdmin" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
<script type="text/javascript" src="../Js/jquery.js" ></script>
    <script>
        function select2(type, id) {
            var d = '';
            if (type == 'Department')
                d = 'd';
           
             
            window.showModalDialog("../Function.Web/UserChooser.aspx?SelectType=" + type + "&nocache=" + Math.random() * 10000 + "&ReturnValueFormat=" + encodeURI(d + "name" + id + ":Name|" + d + "dsp" + id + ":DisplayName|" + d + "id" + id + ":ID"), document, "dialogWidth:800px;dialogHeight:600px;status:yes;resizable:no");
            var idvalue = document.getElementById('id' + id).value;
            var index = idvalue.indexOf(';');
            if (index != -1) {
                document.getElementById('id' + id).value = idvalue.substring(0, index);
            }
              idvalue = document.getElementById('dsp' + id).value;
              index = idvalue.indexOf(';');
            if (index != -1) {
                document.getElementById('dsp' + id).value = idvalue.substring(0, index);
            }
            idvalue = document.getElementById('name' + id).value;
            index = idvalue.indexOf(';');
            if (index != -1) {
                document.getElementById('name' + id).value = idvalue.substring(0, index);
            }
        }

        function check() {
            var pairs = '';
            $("#tbl > tbody > tr > th > input:button").each(function() {
               
                pairs += ',' + $(this).prev().val() + "|" + $("#did" + $(this).attr("id").replace('b', '')).val();

            });
            $("#tb1").val(pairs);
            return true;
        }
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <asp:TextBox runat="server" ID="tb1" style="display:none" ></asp:TextBox>
    <asp:Button runat="server" ID="btnSave" Text="保存" 
        OnClientClick ="return check()" onclick="btnSave_Click"  />
    <table id="tbl">
        <tr>
            <td>
                审核人
            </td>
            <td>
                审核部门
            </td>
        </tr>
        <asp:Repeater runat="server" ID="rpList">
            <ItemTemplate>
                <tr>
                    <th>
                        <input type="text" id="dsp<%#Eval("ID") %>" value="<%#Eval("UserDisplayName") %>"
                            readonly="readonly" />
                        <input type="text" id="name<%#Eval("ID") %>" value="<%#Eval("UserName") %>" style="display: none" />
                        <input type="text" id="id<%#Eval("ID") %>" value="<%#Eval("UserID") %>" style="display:none " />
                        <input type="button" id="b<%#Eval("ID") %>" value="选择" onclick="select2('User','<%#Eval("ID") %>')" />
                    </th>
                    <td>
                        <input type="text" id="ddsp<%#Eval("ID") %>" value="<%#Eval("DepartmentDisplayNames") %>"
                            readonly="readonly" />
                        <input type="text" id="dname<%#Eval("ID") %>" value="<%#Eval("DepartmentNames") %>"
                            style="display: none" />
                        <input type="text" id="did<%#Eval("ID") %>" value="<%#Eval("DepartmentIDs") %>" style="display: none" />
                        <input type="button" id="db<%#Eval("ID") %>" value="选择" onclick="select2('Department','<%#Eval("ID") %>')" />
                    </td>
                </tr>
            </ItemTemplate>
        </asp:Repeater>
    </table>
    </form>
</body>
</html>
